Skip to content

Discord Bot: Synchronize programming languages roles with languages current user knows - #298

Open
konard wants to merge 3 commits into
mainfrom
issue-107-74ce9552
Open

Discord Bot: Synchronize programming languages roles with languages current user knows#298
konard wants to merge 3 commits into
mainfrom
issue-107-74ce9552

Conversation

@konard

@konard konard commented Sep 13, 2025

Copy link
Copy Markdown
Member

Summary

This PR implements a comprehensive Discord bot that automatically synchronizes programming language roles with the languages users actually know based on their GitHub repositories.

Features

Automatic Language Detection: Analyzes public GitHub repositories to detect programming languages and their usage
Smart Role Management: Automatically assigns/removes Discord roles based on actual language usage
15+ Language Support: C#, JavaScript, TypeScript, Python, Java, C++, Go, Rust, Ruby, PHP, Swift, Kotlin, Dart, Scala, F#, Clojure, Haskell
User-Friendly Commands:

  • !sync-roles <github-username> - Links GitHub account and synchronizes roles
  • !my-sync - Re-synchronizes using previously linked account
  • !check-languages <github-username> - Shows detected languages without changing roles
  • !help - Shows available commands

Rich User Experience: Beautiful Discord embeds with detailed language statistics and percentages
Configurable: Custom role mappings and thresholds via appsettings.json
Robust Error Handling: Comprehensive logging and graceful error recovery
Modern Architecture: .NET 8, dependency injection, hosted services

Technical Implementation

  • Discord.Net 3.15.3 for Discord API integration
  • Octokit 13.0.1 for GitHub API integration
  • Microsoft.Extensions.Hosting for service lifecycle management
  • Integration with existing LinksPlatform storage system
  • Enhanced FileStorage with key-value mapping support for user-GitHub associations

Test Plan

  • Build succeeds without errors
  • Project integrates with existing solution structure
  • Storage layer enhanced with backward compatibility
  • Configuration structure provides flexibility for role mappings
  • Command structure follows Discord.Net best practices
  • GitHub API integration handles rate limits and errors gracefully

Configuration Required

To deploy this bot, server administrators need to:

  1. Create Discord bot application and get token
  2. Generate GitHub personal access token for API access
  3. Create programming language roles in Discord server
  4. Update appsettings.json with tokens and role mappings
  5. Add bot to server with appropriate permissions (Manage Roles, Send Messages, etc.)

Architecture

DiscordBot/
├── Program.cs                          # Application entry point
├── DiscordBotSettings.cs               # Configuration model
├── Services/
│   ├── DiscordBotHostedService.cs      # Background service host
│   ├── DiscordBotService.cs            # Main bot logic & Discord events
│   ├── GitHubLanguageDetectionService.cs # GitHub API integration
│   └── ProgrammingLanguageRoleService.cs # Role synchronization logic
├── Modules/
│   └── LanguageRoleModule.cs           # Discord command handlers
├── appsettings.json                    # Configuration template
└── README.md                           # Setup and usage documentation

This implementation solves issue #107 by providing a complete, production-ready Discord bot that bridges GitHub programming language expertise with Discord community roles.

🤖 Generated with Claude Code


Resolves #107

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #107
@konard konard self-assigned this Sep 13, 2025
This commit adds a comprehensive Discord bot that synchronizes user roles
with programming languages detected from their GitHub repositories.

Features:
- Analyzes public GitHub repositories to detect programming languages
- Automatically assigns/removes Discord roles based on language usage
- Supports 15+ programming languages with configurable role mappings
- User-friendly commands: !sync-roles, !my-sync, !check-languages, !help
- Rich Discord embeds with detailed language statistics
- Comprehensive logging and error handling
- Integration with existing LinksPlatform storage system

Technical implementation:
- Modern .NET 8 architecture with dependency injection
- Discord.Net library for Discord API integration
- Octokit for GitHub API integration
- Microsoft.Extensions.Hosting for service lifecycle management
- Configurable through appsettings.json
- Added supporting methods to FileStorage for key-value mappings

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Discord Bot: Synchronize programming languages roles with languages current user knows Discord Bot: Synchronize programming languages roles with languages current user knows Sep 13, 2025
@konard
konard marked this pull request as ready for review September 13, 2025 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord Bot: Synchronize programming languages roles with languages current user knows

1 participant